com.doclinx.ftxml
Class MXSSearch

java.lang.Object
  |
  +--com.doclinx.ftxml.MXSSearch

public final class MXSSearch
extends java.lang.Object

This class permits sequential searching of multiple catalogs with the same query.

See Also:
CatalogSearch

Field Summary
static java.lang.String stdLog
           
 
Constructor Summary
MXSSearch(java.lang.String[] catPathList)
          API: Constructor for class MXSSearch taking path and list of catalog names.
MXSSearch(java.lang.String[] catPathList, com.doclinx.jftr.Log log)
          API: Constructor for class MXSSearch taking path and list of catalog names.
MXSSearch(java.lang.String[] catPathList, java.lang.String logFile, int logLevel)
          API: Constructor for class MXSSearch taking path and list of catalog names.
MXSSearch(java.lang.String path, java.lang.String catList)
          API: Constructor for class MXSSearch taking path and list of catalog names.
MXSSearch(java.lang.String path, java.lang.String catList, com.doclinx.jftr.Log log)
          API: Constructor for class MXSSearch taking path and list of catalog names.
MXSSearch(java.lang.String path, java.lang.String catList, java.lang.String logFile, int logLevel)
          API: Constructor for class MXSSearch taking path and list of catalog names.
 
Method Summary
 void close()
          API: Close multiple catalog search object.
 int dbCount()
          API: Close multiple catalog search object.
 int dbHitCount()
          API: Calculates the number of catalogs that matched that last query.
 long docCount()
          API: Obtains the number of documents matching the last search.
 long docCount(int db)
          API: Obtains the number of documents matching the last search for the given catalog.
 void finalize()
          Override default finalize to ensure multiple catalog search handle closed.
 com.doclinx.ftxml.CatalogManager getCatalog(int db)
          API: Returns the CatalogItem data for the hit specified by the dh parameter.
 com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList, int start, int n)
          API: Returns the DB DOCHIT list of all the document hits matching the last query.
 com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList, int start, int n, java.lang.String[] keys)
          API: Returns the DB DOCHIT list of all the document hits matching the last query.
 com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList, int start, int n, java.lang.String[] keys, boolean sortWithinCatalog)
          API: Returns the DB DOCHIT list of all the document hits matching the last query.
 com.doclinx.jftr.DBDOCHIT[] getDocList(int start, int n)
          API: Returns the DB DOCHIT list of all the document hits matching the last query.
 com.doclinx.jftr.DBDOCHIT[] getDocList(int start, int n, java.lang.String[] keys)
          API: Returns the DB DOCHIT list of all the document hits matching the last query.
 com.doclinx.ftxml.CatalogItem getEntry(com.doclinx.jftr.DBDOCHIT dh)
          API: Returns the CatalogItem data for the hit specified by the dh parameter.
 java.lang.String getName(com.doclinx.jftr.DBDOCHIT dh)
          API: Obtains the name of a catalog (without path) for specified DBDOCHIT.
 java.lang.String getPDFHighlight(com.doclinx.jftr.DBDOCHIT dh)
          API: Get PDF highlight file format String for specified document hit.
 java.util.Vector getWildcardLookup(com.doclinx.jftr.DBDOCHIT dh)
          API: Return the specific match(es) to a wildcard search for a specific document.
 java.util.Vector[] getWildcardLookup(com.doclinx.jftr.DBDOCHIT[] dh, java.lang.String sep)
          API: Return the specific match(es) to a wildcard search for a document hit list.
 java.util.Vector getWildcardLookup(com.doclinx.jftr.DBDOCHIT dh, java.lang.String sep)
          API: Return the specific match(es) to a wildcard search for a specific document.
 long hitCount()
          API: Obtains the total number of hits matching the search.
 long maxCount()
          API: Obtains the total number of documents in all the catalogs.
 void search(java.lang.String query)
          API: Perform search on all the databases using the specified query.
 void search(java.lang.String query, boolean errNoXPath)
          API: Perform search on all the databases using the specified query.
 long searchTime()
          API: Provides the time required to perform last search.
 void setDateFormats(java.lang.String dateFormats)
          API: Set the date formats to use for document sorting of metadata.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stdLog

public static java.lang.String stdLog
Constructor Detail

MXSSearch

public MXSSearch(java.lang.String path,
                 java.lang.String catList)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A single path and the catalog names on this path are supplied. Uses standard log name placed at root.

Parameters:
path - Absolute path of the catalog directory.
catList - List of comma delimted catalog names.
Throws:
CatalogSearchException - See constant definitions.

MXSSearch

public MXSSearch(java.lang.String path,
                 java.lang.String catList,
                 java.lang.String logFile,
                 int logLevel)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A single path and the catalog names on this path are supplied.

Parameters:
path - Absolute path of the catalog directory.
catList - List of comma delimted catalog names.
logFile - Filename for common log file.
logLevel - Severity level, see debug settings.
Throws:
CatalogSearchException - See constant definitions.

MXSSearch

public MXSSearch(java.lang.String path,
                 java.lang.String catList,
                 com.doclinx.jftr.Log log)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A single path and the catalog names on this path are supplied.

Parameters:
path - Absolute path of the catalog directory.
catList - List of comma delimted catalog names.
log - Logger to use for logging.
Throws:
CatalogSearchException - See constant definitions.

MXSSearch

public MXSSearch(java.lang.String[] catPathList)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A String array provides the list of full catalog path references (the catalog path + catalog name)

Parameters:
catPathList - Array of String denoting path and catalog names.
Throws:
CatalogSearchException - See constant definitions.

MXSSearch

public MXSSearch(java.lang.String[] catPathList,
                 java.lang.String logFile,
                 int logLevel)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A String array provides the list of full catalog path references A common log file can be specified for the several catalogs. (the catalog path + catalog name)

Parameters:
catPathList - Array of String denoting path and catalog names.
logFile - Filename for common log file.
logLevel - Severity level, see debug settings.
Throws:
CatalogSearchException - See constant definitions.

MXSSearch

public MXSSearch(java.lang.String[] catPathList,
                 com.doclinx.jftr.Log log)
          throws CatalogSearchException
API: Constructor for class MXSSearch taking path and list of catalog names. Provides simple mechanism for searching a set of catalog objects. A String array provides the list of full catalog path references (the catalog path + catalog name)

Parameters:
catPathList - Array of String denoting path and catalog names.
log - Logger to use for logging.
Throws:
CatalogSearchException - See constant definitions.
Method Detail

finalize

public void finalize()
Override default finalize to ensure multiple catalog search handle closed.

Overrides:
finalize in class java.lang.Object

close

public void close()
           throws CatalogSearchException
API: Close multiple catalog search object. name.

Throws:
CatalogSearchException - See constant definitions.

dbCount

public int dbCount()
API: Close multiple catalog search object.

Returns:
Returns the number of catalogs opened in the object.

getName

public java.lang.String getName(com.doclinx.jftr.DBDOCHIT dh)
API: Obtains the name of a catalog (without path) for specified DBDOCHIT.

Parameters:
dh - The DBDOCHIT with the catalog index of the required name.
Returns:
Returns the specified catalog name.

search

public void search(java.lang.String query)
            throws CatalogSearchException
API: Perform search on all the databases using the specified query.

Parameters:
query - Query specifying search criteria.
Throws:
CatalogSearchException - See constant definitions.

search

public void search(java.lang.String query,
                   boolean errNoXPath)
            throws CatalogSearchException
API: Perform search on all the databases using the specified query.

Parameters:
query - Query specifying search criteria.
errNoXPath - Throw error exception if any xpath not found.
Throws:
CatalogSearchException - See constant definitions.

maxCount

public long maxCount()
API: Obtains the total number of documents in all the catalogs.

Returns:
Returns the maximum number of documents in the catalog set.

docCount

public long docCount()
              throws CatalogSearchException
API: Obtains the number of documents matching the last search.

Returns:
Returns the total number of documents that match a search.
Throws:
CatalogSearchException - See constant definitions.

docCount

public long docCount(int db)
              throws CatalogSearchException
API: Obtains the number of documents matching the last search for the given catalog.

Parameters:
db - Index of the catalog
Returns:
Returns the total number of documents that match a search; If index is out of range, -1 is returned.
Throws:
CatalogSearchException - See constant definitions.

hitCount

public long hitCount()
              throws CatalogSearchException
API: Obtains the total number of hits matching the search.

Returns:
Returns the total number of hitsthat match a search;
Throws:
CatalogSearchException - See constant definitions.

dbHitCount

public int dbHitCount()
               throws CatalogSearchException
API: Calculates the number of catalogs that matched that last query.

Returns:
Returns how mant catalogs had at least one match to the query.
Throws:
CatalogSearchException - See constant definitions.

searchTime

public long searchTime()
                throws CatalogSearchException
API: Provides the time required to perform last search.

Returns:
Returns number of milliseconds required for last search.
Throws:
CatalogSearchException - See constant definitions.

getDocList

public com.doclinx.jftr.DBDOCHIT[] getDocList(int start,
                                              int n)
                                       throws CatalogSearchException
API: Returns the DB DOCHIT list of all the document hits matching the last query. The order and number of catalogs is taken from the constructor list order.

Parameters:
start - The starting index to begin list. The 1st document hit is numbered 1.
n - The number of items to return. If n is greater than remaining items, then just the remaining items are returned.
Returns:
Returns array of DBDOCHIT that indicates the documents in each catalog that matches the last query.
Throws:
CatalogSearchException - See constant definitions.

getDocList

public com.doclinx.jftr.DBDOCHIT[] getDocList(int start,
                                              int n,
                                              java.lang.String[] keys)
                                       throws CatalogSearchException
API: Returns the DB DOCHIT list of all the document hits matching the last query. Documents are sorted globally across catalogs by the metadata keys provided.

Parameters:
start - The starting index to begin list. The 1st document hit is numbered 1.
n - The number of items to return. If n is greater than remaining items, then just the remaining items are returned.
keys - An array of xpaths specifying sort keys. See catXSGetSortedDocList for sort key definitions. Sorting is across all catalogs.
Returns:
Returns array of DBDOCHIT that indicates the documents in each catalog that matches the last query.
Throws:
CatalogSearchException - See constant definitions.

getDocList

public com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList,
                                              int start,
                                              int n)
                                       throws CatalogSearchException
API: Returns the DB DOCHIT list of all the document hits matching the last query. The documents are ordered by catalog IDs provided by the sList parameter.

Parameters:
sList - An array of integers that give the catalog subset to return for document results. The indexes in this array must be between 0 and the number of catalogs opened - 1. The subset also provides the order of return (e.g. catalogs 2,1,3).
start - The starting index to begin list. The 1st document hit is numbered 1.
n - The number of items to return. If n is greater than remaining items, then just the remaining items are returned.
Returns:
Returns array of DBDOCHIT that indicates the documents in each catalog that matches the last query.
Throws:
CatalogSearchException - See constant definitions.

getDocList

public com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList,
                                              int start,
                                              int n,
                                              java.lang.String[] keys)
                                       throws CatalogSearchException
API: Returns the DB DOCHIT list of all the document hits matching the last query. The documents are ordered by catalog provided by the sList parameter and then sub-sorted by the metadata keys.

Parameters:
sList - An array of integers that give the catalog subset to return for document results. The indexes in this array must be between 0 and the number of catalogs opened - 1. The subset also provides the order of return (e.g. catalogs 2,1,3).
start - The starting index to begin list. The 1st document hit is numbered 1.
n - The number of items to return. If n is greater than remaining items, then just the remaining items are returned.
keys - An array of xpaths specifying sort keys. See catXSGetSortedDocList for sort key definitions.
Returns:
Returns array of DBDOCHIT that indicates the documents in each catalog that matches the last query.
Throws:
CatalogSearchException - See constant definitions.

getDocList

public com.doclinx.jftr.DBDOCHIT[] getDocList(int[] sList,
                                              int start,
                                              int n,
                                              java.lang.String[] keys,
                                              boolean sortWithinCatalog)
                                       throws CatalogSearchException
API: Returns the DB DOCHIT list of all the document hits matching the last query. The documents are ordered by catalog IDs provided by the sList parameter and then sub-sorted by the metadata keys, UNLESS doing sorting globally by keys (sortWithinCatalog is false).

Parameters:
sList - An array of integers that give the catalog subset to return for document results. The indexes in this array must be between 0 and the number of catalogs opened - 1. The subset also provides the order of return (e.g. 2,1,3)
start - The starting index to begin list. The 1st document hit is numbered 1.
n - The number of items to return. If n is greater than remaining items, then just the remaining items are returned.
keys - An array of xpaths specifying sort keys. See catXSGetSortedDocList for sort key definitions.
sortWithinCatalog - If set, sort results catalog-by-catalog in order specified. If false, results are sorted globally without regard to order defined by the catalog subset list (sList[]).
Returns:
Returns array of DBDOCHIT that indicates the documents in each catalog that matches the last query.
Throws:
CatalogSearchException - See constant definitions.

getEntry

public com.doclinx.ftxml.CatalogItem getEntry(com.doclinx.jftr.DBDOCHIT dh)
                                       throws CatalogSearchException,
                                              CatalogMgrException
API: Returns the CatalogItem data for the hit specified by the dh parameter.

Parameters:
dh - The DBDOCHIT with the catalog index/document number of the required entry.
Returns:
CatalogItem containing extended information of the document hit.
Throws:
CatalogSearchException - See constant definitions.
CatalogMgrException - See constant definitions.

getCatalog

public com.doclinx.ftxml.CatalogManager getCatalog(int db)
                                            throws CatalogSearchException
API: Returns the CatalogItem data for the hit specified by the dh parameter.

Parameters:
db - Specifies which catalog handle to return.
Returns:
CatalogManager Requested catalog manager handle (null is error).
Throws:
CatalogSearchException - See constant definitions.

setDateFormats

public void setDateFormats(java.lang.String dateFormats)
API: Set the date formats to use for document sorting of metadata.

Parameters:
dateFormats - String containing date format list.

getWildcardLookup

public java.util.Vector getWildcardLookup(com.doclinx.jftr.DBDOCHIT dh)
                                   throws CatalogSearchException
API: Return the specific match(es) to a wildcard search for a specific document.

Parameters:
dh - The DBDOCHIT with the catalog index/document number to match.
Returns:
Vector of String (possible of zero length containing the specific matches to a wildcard query.
Throws:
CatalogSearchException - See constant definitions.

getWildcardLookup

public java.util.Vector getWildcardLookup(com.doclinx.jftr.DBDOCHIT dh,
                                          java.lang.String sep)
                                   throws CatalogSearchException
API: Return the specific match(es) to a wildcard search for a specific document.

Parameters:
dh - The DBDOCHIT with the catalog index/document number to match.
sep - If not null, then return the wildcard, plus the separator plus the specific match. If null, just return the match.
Returns:
Vector of String containing the specific matches to a wildcard query (Note: vector size could be 0 for no matches).
Throws:
CatalogSearchException - See constant definitions.

getWildcardLookup

public java.util.Vector[] getWildcardLookup(com.doclinx.jftr.DBDOCHIT[] dh,
                                            java.lang.String sep)
                                     throws CatalogSearchException
API: Return the specific match(es) to a wildcard search for a document hit list.

Parameters:
dh - The DBDOCHIT List with the catalog index/document numbers to match.
sep - If not null, then return the wildcard, plus the separator plus the specific match. If null, just return the match.
Returns:
Vector array of String containing the specific matches to a wildcard query. One vector for each catalog (Note: vector size per catalog could be 0 for no matches).
Throws:
CatalogSearchException - See constant definitions.

getPDFHighlight

public java.lang.String getPDFHighlight(com.doclinx.jftr.DBDOCHIT dh)
                                 throws CatalogSearchException
API: Get PDF highlight file format String for specified document hit.

Parameters:
dh - The DBDOCHIT with the catalog index/document for HFF data.
Returns:
String containing the document highlight information in pseudo-XML.
Throws:
CatalogSearchException - See constant definitions.